CC = gcc
CFLAGS = -Wall -g
LDFLAGS = -ltss2-sys -ltss2-tctildr -ltss2-rc

TCTI_NAME := $(shell if [ -c /dev/tpm0 ] || [ -c /dev/tpmrm0 ]; then echo "tabrmd"; else echo "mssim"; fi)
CFLAGS += -DTCTI_NAME=\"$(TCTI_NAME)\"

all: rsa_encrypt_decrypt.run

rsa_encrypt_decrypt.run: rsa_encrypt_decrypt.c
	$(CC) $(CFLAGS) -o $@ $< $(LDFLAGS)

run: rsa_encrypt_decrypt.run
	./rsa_encrypt_decrypt.run

clean:
	rm -f rsa_encrypt_decrypt.run
